#include "AnaDef.h"
#include "XGLUtils.h"
#include "TextXYSummary.h"

int main(int argc, char * argv[])
{
  for(Int_t ii=0; ii<argc; ii++){
    printf("%d: %s\n", ii, argv[ii]);
  }

  const Int_t istart = 0;
  const TString xtit = "f";
  const TString ytit[] = {"m(3.15)", "#sigma(0.55)", "#sigma(3.15)", "s(3.15; 0.55)"};

  const Int_t ny=sizeof(ytit)/sizeof(TString);

  TextXYSummary ts(istart, ny, xtit, ytit);

  for(Int_t ii=1; ii<argc; ii++){
    const TString fintxt(argv[ii]);

    TString tag;
    if(fintxt.Contains("126088")){
      tag+= "run 126088";
    }
    else if(fintxt.Contains("128609")){
      tag+= "run 128609";
    }
    else{
      printf("error fintxt! %s\n", fintxt.Data()); exit(1);
    }

    printf("tag: %s\n", tag.Data());

    ts.AddFile(fintxt, tag);
  }

  ts.SetXLimits(0.0,1.0);
  /*
  ts.SetYLimits(0, 1.4, 1.7);
  ts.SetYLimits(1, 0.1, 0.4);
  ts.SetYLimits(2, 0.1, 0.4);
  ts.SetYLimits(3, 0, 5);
  */
  ts.Write("summaryFrac", 0.07, 0.12, 0.9, 0.43, "lp");
}
